<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" id="vp" content="width=device-width, initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<title>贝达教育</title>
		<link href="../../../css/style.css" rel="stylesheet" type="text/css" />
		<link href="../../../css/mui.min.css" rel="stylesheet" type="text/css" />
		<style>
			#takeaddress {
				font-size: 14px;
				background: #fff;
				padding-top: 20px;
			}
			
			.addaddress {
				margin-right: 0.3rem;
				font-size: 14px;
			}
			
			.takeaddresslist li {
				padding: 0.3rem 0.1rem;
				position: relative;
				border: solid 1px #dfdfdf;
				border-radius: 10px;
				margin: 0 20px;
				margin-bottom: 10px;
				background: #f1f1f1;
			}
			
			.takename {
				padding-right: 0.2rem;
			}
			
			.taketel {
				font-size: 12px;
				color: #939393;
			}
			
			.takeaddresscontent {
				font-size: 12px;
				width: 90%;
				display: inline-block;
				padding-top: 5px;
			}
			
			.editor {
				position: absolute;
				right: 0.2rem;
				top: 35%;
				font-size: 12px;
				color: #939393;
			}
			
			.editor span {
				font-size: 20px;
				color: #efefef;
				padding-right: 0.2rem;
			}
			
			.moren {
				font-size: 10px;
				background: #fff0ec;
				color: #e75b00;
				padding: 2px;
			}
			
			.orderimg {
				width: 1.5rem;
				height: 1.5rem;
				margin-right: 0.2rem;
				border-radius: 10px;
			}
			
			.status {
				color: #939393;
				font-size: 12px;
				position: absolute;
				left: 2rem;
				bottom: 0.5rem;
			}
			
			.statuswu {
				color: #939393;
				font-size: 12px;
				position: absolute;
				right: 5px;
				bottom: 0.5rem;
			}
			
			.title {
				line-height: 15px;
				text-overflow: -o-ellipsis-lastline;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				line-clamp: 2;
				-webkit-box-orient: vertical;
				line-height: 15px;
				font-size: 12px;
			}
			
			.mui-icon-back:before,
			.mui-icon-left-nav:before {
				display: none;
			}
			
			.heand_con {
				padding: 0;
				width: 80%;
			}
			
			.check {
				position: absolute;
				bottom: 0.1rem;
				float: right;
				right: 5px;
				color: #939393;
			}
		</style>
	</head>

	<body>
		<div id="takeaddress" class="">
			<!--head-开始-->
<div id="pullrefresh" class="mui-content mui-scroll-wrapper list-frame" style="background: #fff;">
				<div class="mui-scroll">
			<!--head-结束-->
			<div class="takeaddresslist" id="takeaddresslist" style="margin-top: 10px;">
				<ul>
					<li v-for="item in address">
						<img class="orderimg fl" :src="item.pic" />
						<div class="orderinfo">
							<span class="title">{{item.name}}</span>
							<div class="status">{{item.status}}</div>
							<div class="statuswu" v-if="item.status!='未发货'">
								物流编号：{{item.emsorder}}

							</div>
							<span @tap="check(item)" v-if="item.status!='未发货'" class="check">查物流</span>
						</div>
						<div class="clear"></div>
					</li>
				</ul>
			</div>
			</div>
		</div>
		</div>
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/app.js"></script>
		<script src="../../../js/vue.min.js"></script>
		<script src="../../../js/token.js"></script>
		<script>
			mui.init({
					gestureConfig: {
						doubletap: true,
						longtap: true, //默认为false 
						click: true
					},
					pullRefresh: {
						container: '#pullrefresh',
						down: {
							callback: function() {
								pages = 1
								pulldownRefresh(pages)
							}
						},
						up: {
							contentrefresh: '正在加载...',
							callback: function() {
								pages++;
								pullupRefresh(pages)
							}
						}
					}
				});
			var pages = 1;
			mui.plusReady(function() {
				state = app.getState();
				uid = state.userid;
				memberToken = state.memberToken;
				data = {
					uid: uid,
					memberToken: memberToken,
					page:1
				}
				mui.post(Apiurl + 'shop/orderlist_new', data, function(data) {
					if(data.list && data.list.length > 0) {
						pullrefresh.address = data.list
					}
					mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
				}, 'json');
			})
			var pullrefresh = new Vue({
				el: '#pullrefresh',
				data: {
					address: [],
				},
				methods: {
					editoraddress: function(item) {
						var name = item.receive_name;
						var tel = item.receive_phone;
						var province = item.province;
						var xiangxiaddress = item.receive_address;
						var listid = item.id;
						mui.openWindowWithTitle({
							url: 'editoraddress.html',
							id: 'editoraddress',
							preload: true,
							show: {
								aniShow: 'pop-in',
								autoShow: true
							},
							extras: {
								name: name,
								tel: tel,
								pro: province,
								xiangxiaddress: xiangxiaddress,
								listid: listid
							},
							waiting: {
								autoShow: true
							}
						});
					},
					editoradd: function() {
						mui.openWindowWithTitle({
							url: 'editoraddressother.html',
							id: 'editoraddressother',
							preload: true,
							show: {
								aniShow: 'pop-in',
								autoShow: true
							},
							waiting: {
								autoShow: true
							}
						});
					},
					check: function(item) {
						mui.openWindowWithTitle({
							url: 'http://m.kuaidi100.com/result.jsp?nu=' + item.emsorder,
							id: 'kuaidi100',
							preload: true,
							show: {
								aniShow: 'pop-in',
								autoShow: true
							},
							styles: {
								"render": "always",
								"popGesture": "hide",
								"bounce": "vertical",
								"bounceBackground": "#efeff4",
								"titleNView": titleNView = { //详情页原生导航配置
									autoBackButton: true, //自动绘制返回箭头
									backgroundColor: '#fff', //导航栏背景色
									titleText: "查询单号", //导航栏标题
									titleColor: '#000', //文字颜色
									//coverage:"120px",
									//type: 'transparent', //透明渐变样式

								}
							},
							waiting: {
								autoShow: true
							}
						});

					}
				}
			})

			
			window.addEventListener('refreshaddress', function(event) {
				mui.post(Apiurl + 'shop/addresslist', {
					uid: uid,
					memberToken: memberToken,
				}, function(data) {
					//console.log(JSON.stringify(data)) 
					takeaddress.address = data.list
				}, 'json');
			});
			//下拉刷新
			function pulldownRefresh(pages) {
				if(window.plus && plus.networkinfo.getCurrentType() === plus.networkinfo.CONNECTION_NONE) {
					plus.nativeUI.toast('似乎已断开与互联网的连接', {
						verticalAlign: 'top'
					});
					return;
				}
				data.page = pages;
				//获取消息列表
				mui.post(Apiurl + 'shop/orderlist_new', data, function(data) {
					if(data.list && data.list.length > 0) {
						pullrefresh.address = data.list
					}
					mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
				}, 'json');

			}
			//上拉加载
			function pullupRefresh(pages) {
				data.page = pages;
				//获取消息列表
				mui.post(Apiurl + 'shop/orderlist_new', data, function(data) {
					if(pages <= data.pagecount) {
						if(data.list && data.list.length > 0) {
							pullrefresh.address = pullrefresh.address.concat(data.list)
						}
					}
					mui('#pullrefresh').pullRefresh().endPullupToRefresh();
				}, 'json');
				//mui('#takeaddress').pullRefresh().endPullupToRefresh();
			}
		</script>
	</body>

</html>